<?php
class Admincpanel_AdminMemberController extends Zendvn_Controller_Action {
	
	//Mang tham so nhan duoc o moi Action
	protected $_arrParam;
	
	public function init()
	{
		//Mang tham so nhan duoc o moi Action
		$this->_arrParam = $this->_request->getParams();
		
		//Truyen ra view
		$this->view->base_url = APPLICATION_URL;
	}
		
	public function indexAction()
	{	
		$this->view->title = 'Danh sách thành viên';
	}
	
	public function actionAction()
	{
		if ($this->_request->isPost())
		{
			$task = strtolower($this->_arrParam['task']);
			$member = new Admincpanel_Model_Member($this->_arrParam);
			echo $member->$task();
		}
		exit;
	}
	
	public function addAction()
	{
		if ($this->_request->isPost())
		{
			$member = new Admincpanel_Model_Member($this->_arrParam);
			echo $member->createpres();
		}
		exit;
	}
	
	public function editAction()
	{
		if ($this->_request->isPost())
		{
			$task = strtolower($this->_arrParam['task']);
			$member = new Admincpanel_Model_Member($this->_arrParam);
			echo $member->$task();
		}
		exit;
	}
	
	public function delAction()
	{
		if ($this->_request->isPost())
		{
			$member = new Admincpanel_Model_Member($this->_arrParam);
			echo $member->deletepres();
		}
		exit;
	}
	
	public function changePassAction()
	{
		if ($this->_request->isPost())
		{
			$member = new Admincpanel_Model_Member($this->_arrParam);
			echo $member->changepass();
			exit;
		}
	}
}